@extends('layouts.app')
@section('title','我的收藏')

@section('content')
    @if(count($products) > 0)
    <div class="row">
        <div class="card">
            <div class="card-header">我的收藏</div>
            <div class="card-body">
                <div class="row">
                    @foreach($products as $product)
                        <div class="col-md-3 mb-2">
                            <div class="card">
                                <a href="{{ route('products.show', ['product' => $product->id]) }}">
                                    <img src="{{$product->image_url}}" class="card-img-top img-thumbnail" alt="{{$product->title}}">
                                </a>
                                <div class="card-body">
                                    <h5 class="card-title text-danger border-bottom">
                                        ￥
                                        <span class="h2">{{$product->price}}</span>
                                    </h5>
                                    <p class="card-text border-bottom pb-2">
                                        <a href="{{ route('products.show', ['product' => $product->id]) }}" class="text-success">
                                            {{$product->title}}
                                        </a>
                                    </p>
                                    <div class="row">
                                        <span class="text-secondary text-xs col-6 border-right text-center">销量:{{$product->sold_count}}笔</span>
                                        <span class="text-secondary text-xs col-6 text-center">评价:{{$product->review_count}}次</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    @endforeach
                </div>
                <div class="float-right">{{ $products->render() }}</div>
            </div>
        </div>
    </div>
    </div>
    @else
        <div class="card">
            <div class="card-header">提醒</div>
            <div class="card-body text-center">
                <h1>您暂时还未收藏任何商品</h1>
                <a class="btn btn-primary" href="{{ route('root') }}">返回首页</a>
            </div>
        </div>
    @endif
@stop
